var webpack = require('webpack');
var path = require('path');
//加载一些插件 
var commonsPlugin = new webpack.optimize.CommonsChunkPlugin('common.js');
// var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlwebpackPlugin = require('html-webpack-plugin');
module.exports = {
    devServer: {
        hot: true,
        quiet: true
    },
    entry: "./main.js",
    output: {
        path: path.join(__dirname, "dist"),
        publicPath: path.join(__dirname, "dist"),
        filename: "[name].js"
    },
    module: {
        loaders: [
            { test: /\.vue$/, loader: 'vue' },
            { test: /\.css$/, loader: 'style-loader!css-loader' },
            { test: /\.(png|jpg)$/, loader: "url?limit=40000" }
        ]
    },
    plugins: [
        // new ExtractTextPlugin("css/index.css"),
        // new webpack.optimize.UglifyJsPlugin({ //压缩代码
        //     compress: {
        //         warnings: false
        //     },
        //     except: ['$super', '$', 'exports', 'require'] //排除关键字
        // }),
        //添加我们的插件 会自动生成一个html文件
        new HtmlwebpackPlugin({
            filename: 'index.html',
            template: path.join(__dirname, 'src/index.html'),
            inject: true,
            hash: true,
        })
    ]

};
